using Eno.Domain.Entity.App;
using Eno.Infrastructure.Configurations;
using Microsoft.EntityFrameworkCore;

namespace Eno.Infrastructure.DataBase;

public class OriginDbContext : DbContext
{
    public DbSet<Eno.Domain.Entity.Log.Log> Logs { get; set; } = null!;

    public OriginDbContext(DbContextOptions<OriginDbContext> options) : base(options) { }

    // 重写 OnModelCreating 方法
    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.ApplyConfiguration(new AppUserConfiguration());
        modelBuilder.ApplyConfiguration(new AppRoleConfiguration());
        modelBuilder.ApplyConfiguration(new AppPermissionConfiguration());
        modelBuilder.ApplyConfiguration(new AppDepartmentConfiguration());
        modelBuilder.ApplyConfiguration(new LogConfiguration());
    }
}